Repository navigation
Invoke-PkProcessBatch no longer needs the kit's functions to be global - #94
Merged
Merged
Conversation
Two of the batch's own closures called Complete-PkProcess and Write-PkMessage by name. A .GetNewClosure() block only sees global functions, so a batch failed with "'Complete-PkProcess' is not recognized" when the kit was loaded for one module only. They're captured up front now, like the private helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Invoke-PkProcessBatchonly worked when the kit's public functions were global. Two of its own callbacks are.GetNewClosure()blocks that callComplete-PkProcessandWrite-PkMessageby name, and such a block only sees global functions. With the kit loaded for one module only, every batch failed with "The term 'Complete-PkProcess' is not recognized". Loading it the documented way isn't affected, since that imports the functions globally.Your own
.GetNewClosure()callbacks still only see global functions; that part is PowerShell's.Tests
Section Z loads the kit inside another module, for that module only, and runs a batch with one command that runs and one that can't start, so both closures are used.
a batch runs when the kit's functions aren't global (kit global=False error: The term 'Complete-PkProcess' is not recognized ...)andand reports the command that couldn't start.🤖 Generated with Claude Code